<?php
/**
 * Created by JetBrains PhpStorm.
 * User: scala
 * Date: 12-10-23
 * Time: 下午1:29
 * To change this template use File | Settings | File Templates.
 */
class EMarketingAction extends Action
{

    function index(){
        $em=M("Emarketing");
        import("ORG.Util.Page");// 导入分页类
        $count=$em->count();
        $Page= new Page($count,10);// 实例化分页类 传入总记录数和每页显示的记录数
        $Page->setConfigArray(array('header'=>'条营销方案','prev'=>'<input type="button" value="<<">','next'=>'<input type="button" value=">>">','first'=>'首页','last'=>'尾页','theme'=>' %totalRow% %header% %nowPage%/%totalPage% 页   %first% %prePage% %upPage%   <span style="color: red;">%linkPage%</span>   %downPage% %nextPage% %end%'));
        $show=$Page->show();//分页显示输出
        $list=$em->limit($Page->firstRow.",".$Page->listRows)->order("id desc")->select();
        $this->assign("list",$list);
        $this->assign('page',$show);// 赋值分页输出
		
		
		$article=M("StaffArticle");
		$user=M("User");
		$centlist=$article->limit('0,3')->order("createtime desc")->select();
        $userList=$user->select();
		$this->assign("centlist",$centlist);
        $this->assign("userList",$userList);
        $this->display();
    }


    function details(){
		$article=M("StaffArticle");
		$user=M("User");
		$centlist=$article->limit('0,3')->order("createtime desc")->select();
        $userList=$user->select();
		$this->assign("centlist",$centlist);
        $this->assign("userList",$userList);
		
        if(!empty($_GET['id'])){
            $em=M("Emarketing");
            $list=$em->find($_GET['id']);
            $this->assign("list",$list);
        }
        $this->display();
    }

}
